<!DOCTYPE html>
<html lang="zh">
<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="keywords" content="">
	<meta name="description" content="">
	<title>角色修改</title>
	<link rel="stylesheet" href="../../../component/pear/css/pear.css">
	<link rel="stylesheet" href="../../../admin/css/dimples.css">
	<link rel="icon" href="../../../admin/images/favicon.ico" type="image/x-icon"/>
</head>
<body>
<form class="layui-form" action="">
	<div class="mainBox">
		<div class="main-container">
			<div class="main-container">
				<div class="layui-form-item layui-hide">
					<label class="layui-form-label">角色编号</label>
					<div class="layui-input-block">
						<input type="text" name="roleId" required lay-verify="required" disabled
									 autocomplete="off" placeholder="请输入标题" class="layui-input">
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label">角色代码</label>
					<div class="layui-input-block">
						<input type="text" readonly name="roleCode" required lay-verify="required"
									 autocomplete="off" placeholder="请输入角色代码" class="layui-input">
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label">角色名称</label>
					<div class="layui-input-block">
						<input type="text" name="roleName" required lay-verify="required"
									 autocomplete="off" placeholder="请输入角色名称" class="layui-input">
					</div>
				</div>
				<div class="layui-form-item layui-form-text">
					<label class="layui-form-label">描述</label>
					<div class="layui-input-block">
                        <textarea placeholder="请输入内容" name="remark" id="remark"
																	class="layui-textarea"></textarea>
					</div>
				</div>
			</div>
		</div>
	</div>
	<div class="bottom">
		<div class="button-container">
			<button type="submit" class="pear-btn pear-btn-primary pear-btn-sm" lay-submit=""
							lay-filter="role-update">
				<i class="layui-icon layui-icon-ok"></i>
				提交
			</button>
			<button type="reset" class="pear-btn pear-btn-sm">
				<i class="layui-icon layui-icon-refresh"></i>
				重置
			</button>
		</div>
	</div>
</form>
<!-- 依 赖 脚 本 -->
<script src="../../../component/layui/layui.js"></script>
<script src="../../../component/pear/pear.js"></script>
<script src="../../../component/pear/dimples.js"></script>
<script>
    layui.use(['form', 'ajax', 'loading','jquery'], function () {
        let $ = layui.jquery;
        let form = layui.form;
        let ajax = layui.ajax;
        let loading = layui.loading;
        let href = location.href;

        ajax.send('/system/role/' + parseParamByHref(href, 'roleId'), {}, function (r) {
            let data = r.data;
            let sysMenu = data[0];
            $("input[name = 'roleId']").attr("value", sysMenu.roleId);
            $("input[name = 'roleCode']").attr("value", sysMenu.roleCode);
            $("input[name = 'roleName']").attr("value", sysMenu.roleName);
            $('#remark').text(sysMenu.remark);
        });

        form.on('submit(role-update)', function (data) {
            loading.Load('1', '');
            ajax.send('/system/role', {
                type: 'put',
                data: JSON.stringify(data.field)
            }, function (result) {
                layer.msg(result.msg, {icon: 1, time: 1000}, function () {
                    parent.layer.close(parent.layer.getFrameIndex(window.name));//关闭当前页
                    parent.layui.table.reload("role-table");
                });
            })
            return false;
        });
    })
</script>
<script>
</script>
</body>
</html>